﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using HR60_PanelSoft.Tools;
using HR60_PanelSoft.View.Base;

namespace HR60_PanelSoft.View.Controls
{
    //GC: [g1]加载面板编辑[TitleComboBox]@s2

	public partial class TitleComboBox : BaseFormControl
	{

        public bool isFilledItem
        {
            get
            {
                return selValue.Items.Count > 0;
            }
        }


        /* [g1.s1]将selValue的选择，传递出去*/

        /* end of [g1.s1] */


		public TitleComboBox()
		{
			InitializeComponent();

			//selValue.ValueChanged += new EventHandler(valueChange);
            selValue.ValueChanged += new ValueChangedHandler(valueChange);
		}

		[Browsable(true)]
		[Description("标题"), Category("String"), DefaultValue("标题")]
		public string Title
		{
			get
			{
				return lblTitle.Text;
			}
			set
			{
				lblTitle.Text = value;
			}
		}

		/// <summary>
		/// 绑定数据
		/// </summary>
		/// <param name="data"></param>
		public void bindData(IDictionary data)
		{
			selValue.bindData(data);
		}

		/// <summary>
		/// 绑定数据
		/// </summary>
		/// <param name="data"></param>
		/// <param name="txtField"></param>
		/// <param name="valField"></param>
		public void bindData(IList data, string txtField, string valField)
		{
			selValue.bindData(data, txtField, valField);
		}

		/// <summary>
		/// 绑定数据
		/// </summary>
		/// <param name="data"></param>
		/// <param name="txtField"></param>
		/// <param name="valField"></param>
		public void bindData(IList data, string txtField)
		{
			selValue.bindData(data, txtField);
		}

		/// <summary>
		/// 绑定数据
		/// </summary>
		/// <param name="data"></param>
		public void bindData(object[] data)
		{
			selValue.bindData(data);
		}

        /* [g1.s2]绑定下拉菜单数据源 */
        /// <summary>
        /// 绑定下拉菜单数据源
        /// </summary>
        public void fillItems(List<SelectItem> si)
        {
            if (null == si)
                return;
            selValue.bindItems(si);
            
        }

        //GC: 传递事件绑定
        /// <summary>
        /// 传递DropDown事件绑定
        /// </summary>
        /// <param name="eh"></param>
        public void addDropDownEvent(EventHandler eh)
        {
            selValue.addDropDownEvent(eh);
        }

		/// <summary>
		/// 清除选择项
		/// </summary>
		public void cleanItems()
		{
			selValue.cleanItems();
		}



		// 重写Value属性
		public override object Value
		{
			get
			{
				return selValue.Value;
			}
			set
			{
				selValue.Value = value;
			}
		}
	}
}
